//
//  VisterView.m
//  Weibo
//
//  Created by APPLE on 2/18/16.
//  Copyright © 2016 renzc. All rights reserved.
//

#import "VisterView.h"
#import "Masonry.h"

@interface VisterView()

@property (nonatomic) UIImageView *iconView;

@property (nonatomic) UIImageView *circleView;

@property (nonatomic) UILabel *massageLabel;

@property (nonatomic) UIButton *registerButton;

@property (nonatomic) UIButton *loginButton;

@end

@implementation VisterView

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    [self setupUI];
    return self;
}

- (void)setupUI {
    self.backgroundColor = [UIColor colorWithWhite: 237.00/255.00 alpha:1];
    [self addSubview:self.iconView];
    [self addSubview:self.circleView];
    [self addSubview:self.massageLabel];
    [self addSubview:self.registerButton];
    [self addSubview:self.loginButton];
    
    [self.iconView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(self);
    }];
    [self.circleView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(self.iconView);
    }];
    [self.massageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.iconView);
        make.top.equalTo(self.circleView.mas_bottom).offset(16);
        make.width.equalTo(@224);
    }];
    [self.registerButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.equalTo(self.massageLabel.mas_leading);
        make.top.equalTo(self.massageLabel.mas_bottom).offset(16);
        make.width.equalTo(@100);
    }];
    [self.loginButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.trailing.equalTo(self.massageLabel.mas_trailing);
        make.top.equalTo(self.massageLabel.mas_bottom).offset(16);
        make.width.equalTo(@100);
    }];
}

#pragma mark - 懒加载

- (UIImageView *)iconView {
    if (_iconView == nil) {
        _iconView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"visitordiscover_feed_image_house"]];
    }
    return _iconView;
}

- (UIImageView *)circleView {
    if (_circleView == nil) {
        _circleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"visitordiscover_feed_image_smallicon"]];
    }
    return _circleView;
}

- (UILabel *)massageLabel {
    if (_massageLabel == nil) {
        _massageLabel = [[UILabel alloc] init];
        _massageLabel.text = @"关注一些人，回这里看看有什么惊喜关注一些人，回这里看看有什么惊喜";
        _massageLabel.textColor = [UIColor darkGrayColor];
        _massageLabel.font = [UIFont systemFontOfSize:14];
        _massageLabel.numberOfLines = 0;
        _massageLabel.textAlignment = NSTextAlignmentCenter;
    }
    return _massageLabel;
}

- (UIButton *)registerButton {
    if (_registerButton == nil) {
        _registerButton = [[UIButton alloc] init];
        [_registerButton setTitle:@"注册" forState: UIControlStateNormal];
        [_registerButton setTitleColor:[UIColor orangeColor] forState:UIControlStateNormal];
        _registerButton.titleLabel.font = [UIFont systemFontOfSize:15];
        [_registerButton setBackgroundImage:[UIImage imageNamed:@"common_button_white_disable"] forState:UIControlStateNormal];
    }
    return _registerButton;
}

- (UIButton *)loginButton {
    if (_loginButton == nil) {
        _loginButton = [[UIButton alloc] init];
        [_loginButton setTitle:@"登陆" forState:UIControlStateNormal];
        [_loginButton setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
        _loginButton.titleLabel.font = [UIFont systemFontOfSize:15];
        [_loginButton setBackgroundImage:[UIImage imageNamed:@"common_button_white_disable"] forState:UIControlStateNormal];
    }
    return _loginButton;
}
@end
